package com.bayleaf.web.insertData;

import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;

import com.bayleaf.common.StringUtil;
import com.bayleaf.core.BayleafServlet;
import com.bayleaf.core.Model;
import com.bayleaf.dao.BayleafDictionaryDAO;

@WebServlet(name = "insertData", urlPatterns = { "/insertData" }, initParams = {
		@WebInitParam(name = "title", value = "Insert Data"),
		@WebInitParam(name = "jsp", value = "/insertData/InsertData") })
public class InsertDataServlet extends BayleafServlet {

	private static final String LineSep = System.getProperty("line.separator");

	@Override
	public String process(Model model) throws Exception {

		/**
		 * 모델에 넘어온 각 값들을 받음
		 */
		String col_ko_input = model.getString("col_ko_input");
		String col_en_input = model.getString("col_en_input");

		String col_ko_fields[] = StringUtil.strTokenizer(col_ko_input);
		String col_en_fields[] = StringUtil.strTokenizer(col_en_input);

		BayleafDictionaryDAO dao = new BayleafDictionaryDAO();
		dao.insertStdNameSet(col_ko_fields, col_en_fields);

		model.setString("output","성공");
		return null;
	}


}
